home *** CD-ROM | disk | FTP | other *** search
- // (C) Copyright Microsoft Corp. 1991. All rights reserved.
- //
- // You have a royalty-free right to use, modify, reproduce and
- // distribute the Sample Files (and/or any modified version) in
- // any way you find useful, provided that you agree that
- // Microsoft has no warranty obligations or liability for any
- // Sample Application Files which are modified.
-
-
- /****************************************************************************
-
- MODULE : INIT.C
-
- PURPOSE : This module contains the functions which do initialization in the program playvfw.
-
- FUNCTIONS :
- PlayVFWInit
- InitVFWStuff
- CreateVideoWindow
- InitDeviceVars
- Morph
- DrawControl
- DoNextPage
- DoPage1
- ReturnDeviceError
-
-
- COMMENTS :
-
- HISTORY : Created By Steven Molstad 8/20/93.
-
- ****************************************************************************/
-
- #include "windows.h"
- #include <stdlib.h>
- #include "playvfw.h"
- #include "proto.h"
- #include "mmsystem.h"
- #include <digitalv.h>
- #include <stdio.h>
- #include <time.h>
-
- /* Procedure called when the application is loaded for the first time */
-
- /****************************************************************************
-
- FUNCTION : PlayVFWInit( HANDLE )
-
- PURPOSE : This function initializes the window class for both the main window and for the
- video playback window on the last page. It also loads the strings associated with
- the application.
-
- COMMENTS : To achieve the black background I changed the background brush to BLACK_BRUSH. This is
- the easiest way to do this.
-
- HISTORY : Created by Steven Molstad 6/1/93
-
- ****************************************************************************/
-
- BOOL PlayVFWInit( hInstance )
- HANDLE hInstance;
- {
- PWNDCLASS pplayvfwClass;
- PWNDCLASS pVidWinClass;
-
- /* Load strings from resource */
- LoadString( hInstance, IDSNAME, (LPSTR)szAppName, 10 );
- LoadString( hInstance, IDSABOUT, (LPSTR)szAbout, 10 );
- MessageLength = LoadString( hInstance, IDSTITLE, (LPSTR)szMessage, 25 );
-
- // set up a class without a menu.
-
- pplayvfwClass = (PWNDCLASS)LocalAlloc( LPTR, sizeof(WNDCLASS) );
-
- pplayvfwClass->hCursor = LoadCursor( NULL, IDC_ARROW);
- pplayvfwClass->hIcon = LoadIcon( hInstance, MAKEINTRESOURCE(PLAYVFWICON) );
- pplayvfwClass->lpszMenuName = NULL;
- pplayvfwClass->lpszClassName = (LPSTR)szAppName;
- pplayvfwClass->hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
- pplayvfwClass->hInstance = hInstance;
- pplayvfwClass->style = CS_HREDRAW | CS_VREDRAW;
- pplayvfwClass->lpfnWndProc = PlayVFWWndProc;
-
- if (!RegisterClass( (LPWNDCLASS)pplayvfwClass ) )
- /* Initialization failed.
- * Windows will automatically deallocate all allocated memory.
- */
- return FALSE;
-
- LocalFree( (HANDLE)pplayvfwClass );
-
- pVidWinClass = (PWNDCLASS)LocalAlloc( LPTR, sizeof(WNDCLASS) );
-
- pVidWinClass->hCursor = LoadCursor( NULL, IDC_ARROW);
- pVidWinClass->hIcon = LoadIcon( hInstance, MAKEINTRESOURCE(PLAYVFWICON) );
- pVidWinClass->lpszMenuName = NULL;
- pVidWinClass->lpszClassName = (LPSTR)"VidWin";
- pVidWinClass->hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
- pVidWinClass->hInstance = hInstance;
- pVidWinClass->style = CS_HREDRAW | CS_VREDRAW;
- pVidWinClass->lpfnWndProc = VideoWndProc;
-
- if (!RegisterClass( (LPWNDCLASS)pVidWinClass ) )
- /* Initialization failed.
- * Windows will automatically deallocate all allocated memory.
- */
- return FALSE;
-
- LocalFree( (HANDLE)pVidWinClass );
- return TRUE; /* Initialization succeeded */
- }
-
- /****************************************************************************
-
- FUNCTION : InitVFWStuff( HANDLE,HANDLE )
-
- PURPOSE : This function creates the owner draw buttons for the initial screen and first
- page of the program. It also opens the VFW device and the waveaudio device. All
- AVI files and wave files for the initial screen and for the first page are opened
- here.
-
- COMMENTS : This function also starts the initial video playing.
-
- HISTORY : Created by Steven Molstad 7/15/93
-
- ****************************************************************************/
-
- BOOL FAR PASCAL InitVFWStuff(hWnd,hInstance)
- HWND hWnd;
- HANDLE hInstance;
- {
-
- RECT Points;
-
- // we are now at page 0 (initialization screen) set the page values as appropriate.
-
- bIsPage0=TRUE;
- bIsPage1=FALSE;
- bIsPage2=FALSE;
-
-
- // open both the VFW device and the waveaudio device. If they don't open return FALSE, and stop the
- // program from loading. If there is no sound in the system don't try to load the waveaudio device.
-
- wGlobalDeviceID = OpenVFWDevice(hWnd);
-
- if (!bNoSound)
- wGlobalAudioDeviceID = OpenWaveDevice();
-
- /* grey menu item first */
- /* enable second */
-
- if (!wGlobalDeviceID)
- {
- MessageBox(GetFocus(),"Can't open device","ERROR",MB_OK);
-
- return FALSE;
- }
-
- if (!bNoSound)
- if (!wGlobalAudioDeviceID)
- {
- MessageBox(GetFocus(),"Can't open Audio device","ERROR",MB_OK);
-
- return FALSE;
- }
-
- // Get the directories for the wave files, ini files and AVI files.
-
- GetDirFromIni(lpDirs,"playvfw");
-
- // Initialize the lpDevice1 memory which is associated with button1 on the first page.
-
- InitDeviceVars(lpDevice1);
-
- // retrieve the device information for button1 as well as where the button is located in the Points structure.
-
- if(!GetStuffFromIni(lpDevice1,1,&Points))
- return FALSE;
-
- // Create the owner draw button representing button1 on the first page. Use the coordinates retrieved
- // from the playvfw.ini file.
-
- lpDevice1->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"Text window",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left, /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_TEXT, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- // Initialize the lpDevice2 memory which is associated with button1 on the first page.
-
- InitDeviceVars(lpDevice2);
-
- // retrieve the device information for button2 as well as where the button is located in the Points structure.
-
- GetStuffFromIni(lpDevice2,2,&Points);
-
- // Create the owner draw button representing button2 on the first page. Use the coordinates retrieved
- // from the playvfw.ini file.
-
- lpDevice2->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"Audio Button",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left, /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_AUDIO, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- // Initialize the lpDevice3 memory which is associated with button1 on the first page.
-
- InitDeviceVars(lpDevice3);
-
- // retrieve the device information for button3 as well as where the button is located in the Points structure.
-
- GetStuffFromIni(lpDevice3,3,&Points);
-
- // Create the owner draw button representing button3 on the first page. Use the coordinates retrieved
- // from the playvfw.ini file.
-
- lpDevice3->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"Video Button",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left, /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_VIDEO, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- // Initialize the lpDevice4 memory which is associated with button4 on the first page.
-
- InitDeviceVars(lpDevice4);
-
- // retrieve the device information for button4 as well as where the button is located in the Points structure.
-
- GetStuffFromIni(lpDevice4,4,&Points);
-
- // Create the owner draw button representing button4 on the first page. Use the coordinates retrieved
- // from the playvfw.ini file.
-
- lpDevice4->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"Animation Button",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left, /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_ANIMATION, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- // Initialize the lpDevice5 memory which is associated with button5 on the first page.
-
- InitDeviceVars(lpDevice5);
-
- // retrieve the device information for button5 as well as where the button is located in the Points structure.
-
- GetStuffFromIni(lpDevice5,5,&Points);
-
- // Create the owner draw button representing button5 on the first page. Use the coordinates retrieved
- // from the playvfw.ini file.
-
- lpDevice5->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"Graphics Button",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left, /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_GRAPHICS, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- // Initialize the lpDevice6 memory which is associated with button6 on the first page.
-
- InitDeviceVars(lpDevice6);
-
- // retrieve the device information for button6 as well as where the button is located in the Points structure.
-
- GetStuffFromIni(lpDevice6,6,&Points);
-
- // Create the owner draw button representing button6 on the first page. Use the coordinates retrieved
- // from the playvfw.ini file.
-
- lpDevice6->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"Help Button",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left , /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_HELP, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
-
- // retrieve the device information for button7 which is the initial screen button
- // as well as where the button is located in the Points structure.
-
- GetStuffFromIni(lpDevice7,7,&Points);
-
- // make initial window coordinates relative to Bitmaps left top corner.
-
- Points.left+=BmpPoints.left;
- Points.top+=BmpPoints.top;
-
- // Create the owner draw button representing the owner draw button on the initial page. Use the
- // coordinates retrieved from the playvfw.ini file.
-
- lpDevice7->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"LargeButton",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left , /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_VIDWIN, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
-
- // show the initial video window.
-
- ShowWindow(lpDevice7->hWnd,SW_SHOWNORMAL);
-
- // play the initial audio if there is an audio device ID (nothing failed) and if we haven't been told
- // not to play the audio. Either in the ini file or there is no sound device.
-
- if (lpDevice7->bPlayAudio)
- if (lpDevice7->wAudioDeviceID)
- PlayWaveFile(lpDevice7->wAudioDeviceID);
-
- // play the initial video if there is a VFW device ID (nothing failed) and if we haven't been told to
- // not play the video in the ini file.
-
- if (lpDevice7->bPlayVideo)
- if (lpDevice7->wDeviceID)
- PlayVFWFile(hWnd,lpDevice7->hWnd,lpDevice7->wDeviceID);
-
- // Set that the video is playing. Therefore if the cursor does not move off of the button the video
- // will continue to play.
-
- lpDevice7->bVideoPlaying=TRUE;
-
-
-
- return TRUE;
-
- }
-
- /****************************************************************************
-
- FUNCTION : CreateVideoWindow(int)
-
- PURPOSE : This function creates the video window used on page 2 and creates the edit control
- also used on page 2. It also creates the Video Playback Control as well as reads the
- text into the edit control.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 7/25/93
-
- ****************************************************************************/
-
- BOOL FAR PASCAL CreateVideoWindow(nButton)
- int nButton;
- {
-
- char szIniName[11];
- RECT Points;
- RECT Points2;
-
-
- HDC hTempDC;
- DLGPROC dlgProc;
-
- wsprintf(szIniName,"button%d",nButton);
-
- // points refers to the VidWin, points2 refers to the control, points3 refers to the edit control.
-
- GetVidWinFromIni(lpDevice9,9,&Points,&Points2,&Points3,szIniName);
-
- lpDevice9->hWnd = CreateWindow((LPSTR)"VidWin",
- (LPSTR)"Video Window",
- WS_CHILD | WS_CLIPSIBLINGS,
- Points.left , /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWndMain, /*parent */
- (HMENU)NULL, /* use class menu */
- (HANDLE)hInst, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- hWndEdit = CreateWindow((LPSTR)"Edit",
- (LPSTR)"",
- WS_CHILD | WS_CLIPSIBLINGS | ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL,
- Points3.left , /* x - ignored for tiled windows */
- Points3.top, /* y - ignored for tiled windows */
- Points3.right, /* cx - ignored for tiled windows */
- Points3.bottom, /* cy - ignored for tiled windows */
- (HWND)hWndMain, /*parent */
- (HMENU)IDC_EDIT, /* use class menu */
- (HANDLE)hInst, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- //ReadTextFileIntoEdit();
-
- // Get a Device context from the video playback window an update the video in that window.
-
- hTempDC=GetDC(lpDevice9->hWnd);
-
- UpdateVFW(lpDevice9->wDeviceID,hTempDC);
-
- ReleaseDC(lpDevice9->hWnd,hTempDC);
-
- // Show the window and create the modeless dialog box for the Video Playback Control.
-
- ShowWindow(lpDevice9->hWnd, SW_SHOWNORMAL );
-
- dlgProc=(DLGPROC)MakeProcInstance(ButtonBarProc,hInst);
-
- hWndButtonBar=CreateDialog(hInst,MAKEINTRESOURCE(BUTTONBAR),hWndMain,dlgProc);
-
- // Position and show the modeless dialog box for the video playback conrtol.
-
- SetWindowPos(hWndButtonBar,(HWND) NULL,Points2.left,Points2.top,Points2.right,Points2.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
-
- // Changed my mind, don't show the button bar at this point since it could screw things up
- // seems to be bringing up random avi movies when it is initially shown.
-
- ShowWindow(hWndButtonBar,SW_HIDE);
-
-
- return FALSE;
- }
-
- /****************************************************************************
-
- FUNCTION : InitDeviceVars(LPDEVICESTRUCT)
-
- PURPOSE : Initialize all the elements of the device structure.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 7/15/93.
-
- ****************************************************************************/
-
- BOOL FAR PASCAL InitDeviceVars(lpDevice)
- LPDEVICESTRUCT lpDevice;
- {
- lpDevice->bVideoPlaying=FALSE;
- lpDevice->bAudioPlaying=FALSE;
- lpDevice->bVideoPaused=FALSE;
- lpDevice->bButtonDown=FALSE;
- lpDevice->bRButtonClicked=FALSE;
-
- return TRUE;
- }
-
- /****************************************************************************
-
- FUNCTION : Morph(LPDEVICESTRUCT,int)
-
- PURPOSE : Retrieve the information for and create the morph window. This includes opening the AVI
- file for the morph.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/15/93.
-
- ****************************************************************************/
-
- BOOL FAR PASCAL Morph(lpDevice,nWhichButton)
- LPDEVICESTRUCT lpDevice;
- int nWhichButton;
- {
- RECT Points;
-
-
- GetPG2FromIni(lpDevice,nWhichButton,&Points,"morph");
-
-
- lpDevice->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"MorphButton",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left , /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWndMain, /*parent */
- (HMENU)IDC_MORPH, /* use class menu */
- (HANDLE)hInst, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
-
-
- ShowWindow(lpDevice->hWnd, SW_SHOWNORMAL );
-
- return TRUE;
-
- }
-
- /****************************************************************************
-
- FUNCTION : DrawControl(HWND,LPDRAWITEMSTRUCT)
-
- PURPOSE : This function is called in response to a WM_DRAWITEM message. This function takes care
- of loading the VFW file into the button when the page initialy is drawn. Or when any of
- the buttons need to be re-drawn.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/15/93
-
- ****************************************************************************/
-
- void DrawControl(HWND hWnd, LPDRAWITEMSTRUCT lpInfo)
- {
-
- if (lpInfo->CtlType != ODT_BUTTON) return;
-
- // Load the bitmap for the image
-
- switch(lpInfo->CtlID)
- {
-
- case IDC_TEXT:
- if (bIsPage1 || bIsPage2)
- {
- textrect=lpInfo->rcItem;
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- UpdateVFW(lpDevice1->wDeviceID,lpInfo->hDC);
- }
-
- } // bIsPage1
- break;
-
- case IDC_AUDIO:
- if (bIsPage1 || bIsPage2)
- {
- audiorect=lpInfo->rcItem;
-
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- UpdateVFW(lpDevice2->wDeviceID,lpInfo->hDC);
- }
- } // bIsPage1
- break;
-
-
-
- case IDC_VIDEO:
- if (bIsPage1 || bIsPage2)
- {
- videorect=lpInfo->rcItem;
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- UpdateVFW(lpDevice3->wDeviceID,lpInfo->hDC);
- }
-
- } // bIsPage1
- break;
-
- case IDC_ANIMATION:
- if (bIsPage1 || bIsPage2)
- {
- animationrect=lpInfo->rcItem;
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- UpdateVFW(lpDevice4->wDeviceID,lpInfo->hDC);
- }
- }// bIsPage1
- break;
-
-
- case IDC_GRAPHICS:
- if (bIsPage1 || bIsPage2)
- {
- graphicsrect=lpInfo->rcItem;
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- UpdateVFW(lpDevice5->wDeviceID,lpInfo->hDC);
- }
- }//bIsPage1
- break;
-
- case IDC_HELP:
- if (bIsPage1 || bIsPage2)
- {
- helprect=lpInfo->rcItem;
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- UpdateVFW(lpDevice6->wDeviceID,lpInfo->hDC);
- }
- }//bIsPage1
- break;
-
- case IDC_VIDWIN:
- if (bIsPage0)
- {
- helprect=lpInfo->rcItem;
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- UpdateVFW(lpDevice7->wDeviceID,lpInfo->hDC);
- }
-
- // if the initial button was pressed set bButtonDown to TRUE.
-
- if (lpInfo->itemAction == ODA_SELECT)
- {
- if(lpDevice7->bButtonDown)
- lpDevice7->bButtonDown=FALSE;
- else
- lpDevice7->bButtonDown=TRUE;
- } // if ODA_SELECT
- } //bIsPage0
- break;
-
- case IDC_MORPH:
- helprect=lpInfo->rcItem;
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- UpdateVFW(lpDevice8->wDeviceID,lpInfo->hDC);
- }
-
- if (lpInfo->itemAction == ODA_SELECT)
- {
- if(lpDevice8->bButtonDown)
- lpDevice8->bButtonDown=FALSE;
- else
- lpDevice8->bButtonDown=TRUE;
- }
- break;
- }
-
-
-
- return;
- }
-
-
- /****************************************************************************
-
- FUNCTION : DoNextPage(int)
-
- PURPOSE : This function sets up the last page of buttons. It takes care of opening the new VFW files.
- It also takes care of hiding the windows and setting the new window positions.
-
- COMMENTS :
-
- HISTORY :
-
- ****************************************************************************/
-
-
- BOOL FAR PASCAL DoNextPage(nWhichButton)
- int nWhichButton;
- {
- RECT Points;
- char szIniName[9];
- //MSG msg;
-
- HideAllWindows();
-
- wsprintf(szIniName,"Button%d",nWhichButton);
-
- InitDeviceVars(lpDevice1);
-
- GetPG2FromIni(lpDevice1,1,&Points,szIniName);
-
- ShowWindow( lpDevice1->hWnd, SW_SHOWNORMAL );
- SetWindowPos(lpDevice1->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
-
- InitDeviceVars(lpDevice2);
-
- GetPG2FromIni(lpDevice2,2,&Points,szIniName);
-
- SetWindowPos(lpDevice2->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
- ShowWindow( lpDevice2->hWnd, SW_SHOWNORMAL );
-
- InitDeviceVars(lpDevice3);
-
- GetPG2FromIni(lpDevice3,3,&Points,szIniName);
-
- SetWindowPos(lpDevice3->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
- ShowWindow( lpDevice3->hWnd, SW_SHOWNORMAL );
-
- InitDeviceVars(lpDevice4);
-
- GetPG2FromIni(lpDevice4,4,&Points,szIniName);
-
- SetWindowPos(lpDevice4->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
- ShowWindow( lpDevice4->hWnd, SW_SHOWNORMAL );
-
- CreateVideoWindow(nWhichButton);
-
-
- bIsPage2=TRUE;
- bIsPage1=FALSE;
- bButtonDown=TRUE;
-
- return TRUE;
- }
-
-
- /****************************************************************************
-
- FUNCTION : DoPage1()
-
- PURPOSE : This function takes care of setting up the first page of buttons. It shows all video buttons
- which were previously setup with VFW files.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/1/93
-
- ****************************************************************************/
-
- BOOL FAR PASCAL DoPage1()
-
- {
-
-
- BOOL bReturn;
-
- InvalidateRect(hWndMain,NULL,TRUE);
-
-
- bIsPage0=FALSE;
- bIsPage1=TRUE;
-
- ShowWindow(lpDevice1->hWnd,SW_SHOWNORMAL);
- ShowWindow(lpDevice2->hWnd,SW_SHOWNORMAL);
- ShowWindow(lpDevice3->hWnd,SW_SHOWNORMAL);
- ShowWindow(lpDevice4->hWnd,SW_SHOWNORMAL);
- ShowWindow(lpDevice5->hWnd,SW_SHOWNORMAL);
- ShowWindow(lpDevice6->hWnd,SW_SHOWNORMAL);
- ShowWindow(lpDevice7->hWnd,SW_HIDE);
-
-
-
- bReturn = CloseWaveFile(lpDevice7->wAudioDeviceID);
-
-
- bReturn = CloseVFWFile(lpDevice7->wDeviceID);
-
-
- return TRUE;
- }
-
-
- /****************************************************************************
-
- FUNCTION : ReturnDeviceError(LPSTR,HANDLE,HANDLE,HANDLE,HANDLE,HANDLE)
-
- PURPOSE : This function is used to return errors when a file cannot be found.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/1/93
-
- ****************************************************************************/
-
- void FAR PASCAL ReturnDeviceError(LPSTR lpBuffer,HANDLE hFileName,HANDLE hSection,HANDLE hBuffer,HANDLE hExeName,HANDLE hAlias)
- {
- HANDLE hBuf;
- LPSTR lpBuf;
-
- hBuf=GlobalAlloc(GHND,255);
- if(!hBuf)
- return;
-
- lpBuf=GlobalLock(hBuf);
-
- if (!lpBuf)
- return;
-
- wsprintf(lpBuf,"The %s file could not be open. Check that the file exists and that it is correct in the initialization file",lpBuffer);
- MessageBox(hWndMain,lpBuf,"ERROR",MB_OK);
-
- GlobalUnlock(hFileName);
- GlobalUnlock(hSection);
- GlobalUnlock(hBuffer);
- GlobalUnlock(hExeName);
- GlobalUnlock(hAlias);
- GlobalUnlock(hBuf);
-
- GlobalFree(hFileName);
- GlobalFree(hSection);
- GlobalFree(hBuffer);
- GlobalFree(hExeName);
- GlobalFree(hAlias);
- GlobalFree(hBuf);
-
- return;
- }
-
-
-
-